/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.totoBD.gui.swing.components.dialog;

import com.totoBD.gui.swing.components.button.BtnCmdOk;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;

/**
 *
 * @author rgil
 */
public abstract class DlgBoxAbs extends DlgAbs implements ActionListener{
    public DlgBoxAbs(String txtError){
        this.lst = this;
        
        lblMessage = new JLabel();
        btnOk = new BtnCmdOk(lst);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        lblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        if(txtError.isEmpty()){
            lblMessage.setText("Unknown problem");
        }
        else{
            lblMessage.setText(txtError);
        }

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addComponent(lblMessage)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addComponent(btnOk)
                .addContainerGap())
        );

        pack();
    }

    private ActionListener lst;
    private JButton btnOk;
    private JLabel lblMessage;

    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Internal coding error");
        
    }
}
